<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>菜鸟教程(runoob.com)</title>
</head>

<body>

    <h2>JavaScript HTML DOM!</h2>

    <p>Hello World!</p>

    <p>Hello Runoob!</p>

    <p id="demo"></p>

    <script>
        var myNodelist = document.querySelectorAll("p");
        document.getElementById("demo").innerHTML = "第二个段落的内容为:<span style='color:red;'> " + myNodelist[1].innerHTML + '</span>';
    </script>

</body>

</html>